<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="width" default="250px"/>
        <cc:attribute name="height" default="150px"/>
        <cc:attribute name="id"/>
        <cc:attribute name="value" required="true"/>
        <cc:attribute name="converter" />
        <cc:attribute name="buttonStyle" default="width: 140px; margin-bottom: 3px;"/>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <p:pickList id="#{cc.attrs.id}" value="#{cc.attrs.value}" var="obj"
                    itemLabel="#{obj}" itemValue="#{obj}">
            <style type="text/css">
                .ui-picklist-source,
                .ui-picklist-target {
                    width: #{cc.attrs.width};
                    height: #{cc.attrs.height};
                }
            </style>
            
            <c:if test="#{!empty cc.attrs.converter}">
                <f:converter converterId="#{cc.attrs.converter}"/>
            </c:if>
            
            <f:facet name="add">
                <p:commandButton value="Atribuir &gt;" style="#{cc.attrs.buttonStyle}"/>
            </f:facet>
            <f:facet name="addAll">
                <p:commandButton value="Atribuir Todos &gt;&gt;" style="#{cc.attrs.buttonStyle}"/>
            </f:facet>

            <f:facet name="remove">
                <p:commandButton value="&lt; Retirar" style="#{cc.attrs.buttonStyle}"/>
            </f:facet>
            <f:facet name="removeAll">
                <p:commandButton value="&lt;&lt; Retirar Todos" style="#{cc.attrs.buttonStyle}"/>
            </f:facet>
        </p:pickList>
    </cc:implementation>
</html>